
// <copyright file="AbstractDataReaderDecorator.cs" company="Subhadra Software Solutions">
//   
// </copyright>
// <summary>
//   The abstract data reader decorator.
// </summary>

namespace SubhadraSolutions.Sharp.Utils.Data.Common
{
    using System;
    using System.Data;

    /// <summary>
    /// The abstract data reader decorator.
    /// </summary>
    public abstract class AbstractDataReaderDecorator : AbstractDisposable, IDataReader
    {
        #region Fields

        /// <summary>
        /// The adaptedObject.
        /// </summary>
        private readonly IDataReader adaptedObject;

        #endregion Fields

        #region Constructors and Finalizers

        /// <summary>
        /// Initializes a new instance of the <see cref="AbstractDataReaderDecorator"/> class.
        /// </summary>
        /// <param name="adaptedObject">
        /// The adaptedObject.
        /// </param>
        protected AbstractDataReaderDecorator(IDataReader adaptedObject)
        {
            this.adaptedObject = adaptedObject;
        }

        #endregion Constructors and Finalizers

        #region Public Properties

        /// <summary>
        /// Gets the depth.
        /// </summary>
        public int Depth
        {
            get
            {
                return this.adaptedObject.Depth;
            }
        }

        /// <summary>
        /// Gets the field count.
        /// </summary>
        public int FieldCount
        {
            get
            {
                return this.adaptedObject.FieldCount;
            }
        }

        /// <summary>
        /// Gets a value indicating whether is closed.
        /// </summary>
        public bool IsClosed
        {
            get
            {
                return this.adaptedObject.IsClosed;
            }
        }

        /// <summary>
        /// Gets the records affected.
        /// </summary>
        public int RecordsAffected
        {
            get
            {
                return this.adaptedObject.RecordsAffected;
            }
        }

        #endregion Public Properties

        #region Properties

        /// <summary>
        /// Gets the adaptedObject.
        /// </summary>
        protected IDataReader AdaptedObject
        {
            get
            {
                return this.adaptedObject;
            }
        }

        #endregion Properties

        #region Public Indexers

        /// <summary>
        /// The this.
        /// </summary>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <returns>
        /// The <see cref="object"/>.
        /// </returns>
        public object this[string name]
        {
            get
            {
                return this.adaptedObject[name];
            }
        }

        /// <summary>
        /// The this.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <returns>
        /// The <see cref="object"/>.
        /// </returns>
        public object this[int i]
        {
            get
            {
                return this.adaptedObject[i];
            }
        }

        #endregion Public Indexers

        #region Public Methods and Operators

        /// <summary>
        /// The close.
        /// </summary>
        public void Close()
        {
            this.adaptedObject.Close();
        }

        /// <summary>
        /// The get boolean.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool GetBoolean(int i)
        {
            return this.adaptedObject.GetBoolean(i);
        }

        /// <summary>
        /// The get byte.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <returns>
        /// The <see cref="byte"/>.
        /// </returns>
        public byte GetByte(int i)
        {
            return this.adaptedObject.GetByte(i);
        }

        /// <summary>
        /// The get bytes.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <param name="fieldOffset">
        /// The field offset.
        /// </param>
        /// <param name="buffer">
        /// The buffer.
        /// </param>
        /// <param name="bufferOffset">
        /// The bufferOffset.
        /// </param>
        /// <param name="length">
        /// The length.
        /// </param>
        /// <returns>
        /// The <see cref="long"/>.
        /// </returns>
        public long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferOffset, int length)
        {
            return this.adaptedObject.GetBytes(i, fieldOffset, buffer, bufferOffset, length);
        }

        /// <summary>
        /// The get char.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <returns>
        /// The <see cref="char"/>.
        /// </returns>
        public char GetChar(int i)
        {
            return this.adaptedObject.GetChar(i);
        }

        /// <summary>
        /// The get chars.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <param name="fieldOffset">
        /// The fieldOffset.
        /// </param>
        /// <param name="buffer">
        /// The buffer.
        /// </param>
        /// <param name="bufferOffset">
        /// The bufferOffset.
        /// </param>
        /// <param name="length">
        /// The length.
        /// </param>
        /// <returns>
        /// The <see cref="long"/>.
        /// </returns>
        public long GetChars(int i, long fieldOffset, char[] buffer, int bufferOffset, int length)
        {
            return this.adaptedObject.GetChars(i, fieldOffset, buffer, bufferOffset, length);
        }

        /// <summary>
        /// The get data.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <returns>
        /// The <see cref="IDataReader"/>.
        /// </returns>
        public IDataReader GetData(int i)
        {
            return this.adaptedObject.GetData(i);
        }

        /// <summary>
        /// The get data type name.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        public string GetDataTypeName(int i)
        {
            return this.adaptedObject.GetDataTypeName(i);
        }

        /// <summary>
        /// The get date time.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <returns>
        /// The <see cref="DateTime"/>.
        /// </returns>
        public DateTime GetDateTime(int i)
        {
            return this.adaptedObject.GetDateTime(i);
        }

        /// <summary>
        /// The get decimal.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <returns>
        /// The <see cref="decimal"/>.
        /// </returns>
        public decimal GetDecimal(int i)
        {
            return this.adaptedObject.GetDecimal(i);
        }

        /// <summary>
        /// The get double.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <returns>
        /// The <see cref="double"/>.
        /// </returns>
        public double GetDouble(int i)
        {
            return this.adaptedObject.GetDouble(i);
        }

        /// <summary>
        /// The get field type.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <returns>
        /// The <see cref="Type"/>.
        /// </returns>
        public Type GetFieldType(int i)
        {
            return this.adaptedObject.GetFieldType(i);
        }

        /// <summary>
        /// The get float.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <returns>
        /// The <see cref="float"/>.
        /// </returns>
        public float GetFloat(int i)
        {
            return this.adaptedObject.GetFloat(i);
        }

        /// <summary>
        /// The get guid.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <returns>
        /// The <see cref="Guid"/>.
        /// </returns>
        public Guid GetGuid(int i)
        {
            return this.adaptedObject.GetGuid(i);
        }

        /// <summary>
        /// The get int 16.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <returns>
        /// The <see cref="short"/>.
        /// </returns>
        public short GetInt16(int i)
        {
            return this.adaptedObject.GetInt16(i);
        }

        /// <summary>
        /// The get int 32.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <returns>
        /// The <see cref="int"/>.
        /// </returns>
        public int GetInt32(int i)
        {
            return this.adaptedObject.GetInt32(i);
        }

        /// <summary>
        /// The get int 64.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <returns>
        /// The <see cref="long"/>.
        /// </returns>
        public long GetInt64(int i)
        {
            return this.adaptedObject.GetInt64(i);
        }

        /// <summary>
        /// The get name.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        public string GetName(int i)
        {
            return this.adaptedObject.GetName(i);
        }

        /// <summary>
        /// The get ordinal.
        /// </summary>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <returns>
        /// The <see cref="int"/>.
        /// </returns>
        public int GetOrdinal(string name)
        {
            return this.adaptedObject.GetOrdinal(name);
        }

        /// <summary>
        /// The get schema table.
        /// </summary>
        /// <returns>
        /// The <see cref="DataTable"/>.
        /// </returns>
        public DataTable GetSchemaTable()
        {
            return this.adaptedObject.GetSchemaTable();
        }

        /// <summary>
        /// The get string.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        public string GetString(int i)
        {
            return this.adaptedObject.GetString(i);
        }

        /// <summary>
        /// The get value.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <returns>
        /// The <see cref="object"/>.
        /// </returns>
        public object GetValue(int i)
        {
            return this.adaptedObject.GetValue(i);
        }

        /// <summary>
        /// The get values.
        /// </summary>
        /// <param name="values">
        /// The values.
        /// </param>
        /// <returns>
        /// The <see cref="int"/>.
        /// </returns>
        public int GetValues(object[] values)
        {
            return this.adaptedObject.GetValues(values);
        }

        /// <summary>
        /// The is db null.
        /// </summary>
        /// <param name="i">
        /// The i.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool IsDBNull(int i)
        {
            return this.adaptedObject.IsDBNull(i);
        }

        /// <summary>
        /// The next result.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool NextResult()
        {
            return this.adaptedObject.NextResult();
        }

        /// <summary>
        /// The read.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public abstract bool Read();

        #endregion Public Methods and Operators

        #region Methods

        /// <summary>
        /// The dispose.
        /// </summary>
        /// <param name="disposing">
        /// The disposing.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            this.adaptedObject.Dispose();
        }

        #endregion Methods
    }
}